package com.bit.ioc.controller;

import com.bit.ioc.config.DbTypeConfig;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/prop")
@RestController
public class PropertiesController {

    @Value("${spring.datasource.url}")
    private String url;
    @Value("${my.key1}")
    private Integer key1;
    @Value("${my.key2}")
    private Boolean key2;


    @RequestMapping("/read")
    public String readProperties(){
        System.out.println(key1);
        System.out.println(key2);
        log.info("使用@slf4j打印日志");
        return "从配置文件中, 读取url:" +url;
    }
}
